﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;

namespace ALS.Component.Tools.AsyncTcp
{
    /// <summary>
    /// TcpClient状态
    /// </summary>
    public class TcpClientState
    {
        /// <summary>
        /// Get TcpClient
        /// </summary>
        public TcpClient TcpClient { get; private set; }

        /// <summary>
        /// Get Buffer
        /// </summary>
        public byte[] Buffer { get; private set; }

        /// <summary>
        /// Get NetworkStream
        /// </summary>
        public NetworkStream NetworkStream { get { return TcpClient.GetStream(); } }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="tcpClient"></param>
        /// <param name="buffer"></param>
        public TcpClientState(TcpClient tcpClient, byte[] buffer)
        {
            if (tcpClient == null)
            {
                throw new ArgumentNullException("tcpClient");
            }
            if (buffer == null)
            {
                throw new ArgumentNullException("buffer");
            }
            this.TcpClient = tcpClient;
            this.Buffer = buffer;
        }
    }
}
